<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Test extends CI_Controller {

	public function go() {
		phpinfo();
	}

	public function start() {
		/*$this->load->library("excel_reader");
		$excel = &$this->excel_reader;
		$excel->setOutputEncoding('UTF-8');
		$excel->read("f:/countries.xls");
        print_r($excel->sheets);
		$numRows = $excel->sheets[0]['numRows'];
		echo $numRows;

		for ($i=3; $i<$numRows; $i++) {
			$row = $excel->sheets[0]['cells'][$i];
            $is_schengen = ($row[8] == 'yes') ? '1' : '0';
			$sql = "insert into visa_countries(cn_name, en_name, short_name, area_name, is_schengen) 
            values('".trim($row[2])."','".trim($row[3])."','".trim($row[4])."','".trim($row[7])."', $is_schengen)";
			echo $sql . "\n";
			//$this->db->query($sql);
			//if($i > 10) break;
		}*/
        
        set_time_limit(0);   
        $fp = fopen("d:/ttt.txt", "r");
        $i = 0;
        while(($str=fgets($fp)) != "") { 
            $row = explode(" ", $str);
            $sql = "update visa_province set en_name='".trim($row[1])."' where province_name='".trim($row[0])."'";
            $this->db->query($sql);
            echo $sql."\n";
        }
        fclose($fp); 

        
	}

	public function svn() {
		file_get_contents('http://localhost:8088/svn');
		echo "svn has updated!";
	}
    
}